package com.cty.controller;

import com.cty.pojo.Menu;
import com.cty.service.MenuService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: cty
 * @Date: 2020/4/1 12:04
 * @Description:
 * @version: 1.0
 */
@Controller
public class MenuController {
    @Resource
    private MenuService menuServiceImpl;

    // 向视图返回菜单信息
    @RequestMapping("showMenu")
    @ResponseBody
    public List<Menu> showMenu(){
        List<Menu> menus = this.menuServiceImpl.selAllMenu();
        return menus;
    }

    // 向视图返回checked的菜单信息
    @RequestMapping("showPrivilege")
    @ResponseBody
    public List<Menu> showPrivilege(int rid){
        List<Menu> menus = this.menuServiceImpl.selAllAddChecked(rid);
        return menus;
    }

}
